// pages/account/account.js
const customRequst = require('../../common/customRequst.js');

Page({

  data: {
    account: '',
    password: '',
  },

  onLoad: function (options) {

  },
  onChange(event) {
    // event.detail 为当前输入的值
    console.log(event.detail);
    this.setData({
      account: event.detail
    })
  },
  onChangePwd(event) {
    // event.detail 为当前输入的值
    console.log(event.detail);
    this.setData({
      password: event.detail
    })
  },
  login() {
    let that = this
    customRequst.postRequest('api/userlogin/account', {
      account: that.data.account,
      password: that.data.password,
    }).then(res => {
      if (res.code == 1) {
        wx.navigateTo({
          url: '/pages/index/index'
        })
      }
    })
  }
})